package org.monkey.common.constant.exception;

import lombok.Data;
import org.monkey.common.constant.entity.ErrorCode;
import org.monkey.common.constant.entity.ErrorResultEnum;

@Data
public class BaseException extends RuntimeException {

  private int status;
  private String devMsg;

  public BaseException() {
  }

  public BaseException(String message, int status) {
    super(message);
    this.status = status;
  }

  public BaseException(String message, int status, String devMsg) {
    super(message);
    this.status = status;
    this.devMsg = devMsg;
  }

  public BaseException(ErrorCode errorCode) {
    super(errorCode.getMsg());
    this.status = errorCode.getCode();
  }

  public BaseException(ErrorCode errorCode, Throwable throwable) {
    super(errorCode.getMsg());
    this.status = errorCode.getCode();
    this.devMsg = throwable.getMessage();
  }

  public BaseException(String message) {
    super(message);
  }

  public BaseException(String message, Throwable cause) {
    super(message, cause);
  }

  public BaseException(Throwable cause) {
    super(cause);
  }

  public BaseException(String message, Throwable cause, boolean enableSuppression,
      boolean writableStackTrace) {
    super(message, cause, enableSuppression, writableStackTrace);
  }

  public BaseException(ErrorResultEnum errorCode, String devMsg) {
    super(errorCode.getMsg());
    this.status = errorCode.getCode();
    this.devMsg = devMsg;
  }
}
